﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Vit.Web.Validation
{
    public class ValidationStateDictionary : Dictionary<Type, ValidationState>
    {
        public ValidationStateDictionary()
        {
        }

        public ValidationStateDictionary(Type type, ValidationState validationState)
        {
            Add(type, validationState);
        }

        public bool IsValid
        {
            get
            {
                return this.All(validationState => validationState.Value == null || validationState.Value.IsValid);
            }
        }
    }
}
